<?php

/**
 * Description of Security
\* www.teuker.nl - mail@teuker.nl
 * 
 * @author francisc
 */

class Security {

    const RIGHT_SETTINGS = 1;
    const RIGHT_CALL_CENTER = 2;

    public static function hasRight($right) {
        $user_type = sfContext::getInstance()->getUser()->getAttribute('user_type');
        
        switch ($right) {
            case Security::RIGHT_SETTINGS:
                if ('manager' == $user_type || 'admin' == $user_type)
                    return true;
                return false;
                break;
            case Security::RIGHT_CALL_CENTER:
                if ('manager' == $user_type || 'admin' == $user_type || 'callcenter' == $user_type)
                    return true;
                return false;
                break;
            default:
                return false;
        }
    }
}
